from dataclasses import dataclass
from enum import Enum

from framework.SerableQueen import SerableQueen


class SendType(Enum):
    send_all: str = "qf"  # 群发
    send_self: str = "self"  # 发给自己


@dataclass
class ReturnData:
    messgae_mod: str  # 传给前台的标识符
    send_type: SendType  # 数据返回的时候如何交给客户端的
    messgae: str


class command_interface:
    def __init__(self, command_splite=None, command_dispatch=None):
        """
        命令解析器
        :param command: 命令
        """
        self.command_splite = command_splite if command_splite is not None else range([])
        self.command_dispatch = None
        self.serable_queen = SerableQueen()

    def run(self, *args, **kwargs) -> ReturnData:
        # 当调用ws://xxx/code 的时候调用我
        ...

    def test(self, *args, **kwargs) -> ReturnData:
        # 当调用ws://xxx/test 的时候调用我
        ...
